/*******************************************
  Jose Andres Lara Vecino

  Author       : $$Author: cainlara@gmail.com $$
  Last CheckIn : $$Date: 2012-06-07 19:05:35 +0000 (Thu, 07 Jun 2012) $$
  Revision     : $$Revision: 60 $$
*******************************************/

package gui.suites.arbol;

import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;

import frente.Suite;

/**
 * Arbol de las suites.
 * 
 * @author jose.lara 06.06.2012
 */
public class SuitesArbol extends JTree {
    private static final long serialVersionUID = 4498534944704372116L;
    
    private SuitesArbolModel modelo         = null;
    private SuitesArbolRenderer renderer    = null;
    
    
    public SuitesArbol() {
        super();
        setModel(getModelo());
        setCellRenderer(getRenderer());
    }
    
    private SuitesArbolModel getModelo() {
        if(modelo == null) {
            DefaultMutableTreeNode raiz = new DefaultMutableTreeNode();
            raiz.setUserObject(new Suite(null, "Raiz", null));
            modelo = new SuitesArbolModel(raiz);
        }
        
        return modelo;
    }
    
    private SuitesArbolRenderer getRenderer() {
        if(renderer == null) {
            renderer = new SuitesArbolRenderer();
        }
        
        return renderer;
    }
}